export default {
  mode: 'spa',
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || '',
      },
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  },
  plugins: ['~/plugins/request', '~/plugins/dayjs'],
  components: true,
  buildModules: ['@nuxtjs/eslint-module'],
  modules: [],
  build: {},
  generate: {
    fallback: 'index.html',
  },
  router: {
    base: './',
    mode: 'hash',
    linkActiveClass: 'active',
    extendRoutes(routes, resolve) {
      routes.splice(0)
      routes.push(
        ...[
          {
            name: 'home',
            path: '/',
            component: resolve(__dirname, 'pages/home/'),
          },
          {
            name: 'login',
            path: '/login',
            component: resolve(__dirname, 'pages/login/'),
          },
          {
            name: 'register',
            path: '/register',
            component: resolve(__dirname, 'pages/login/'),
          },
          {
            name: 'article',
            path: '/article/:slug',
            component: resolve(__dirname, 'pages/article/'),
          },
          {
            name: 'new',
            path: '/editor',
            component: resolve(__dirname, 'pages/editor/'),
          },
          {
            name: 'editor',
            path: '/editor/:slug',
            component: resolve(__dirname, 'pages/editor/'),
          },
          {
            name: 'profile',
            path: '/profile/:username',
            component: resolve(__dirname, 'pages/profile/'),
          },
          {
            name: 'setting',
            path: '/setting',
            component: resolve(__dirname, 'pages/setting/'),
          },
        ]
      )
    },
  },
}
